import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesMaterialRequisition/export`;
// 获取详情
export function getInfo (id = "") {
  return request({
    url: `${mesUrl}mesMaterialRequisition/info/${id}`,
    method: "get",
  });
}
//分页查询
export function getList (params = {}) {
  return request({
    url: `${mesUrl}mesMaterialRequisition`,
    method: "get",
    params,
  });
}
//新增
export function rowCreate (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialRequisition`,
    method: "post",
    data,
  });
}
//修改
export function rowUpdate (data = {}) {
  return request({
    url: `${mesUrl}mesMaterialRequisition`,
    method: "put",
    data,
  });
}
//删除
export function rowDel (id) {
  return request({
    url: `${mesUrl}mesMaterialRequisition/${id}`,
    method: "put",
  });
}
//下拉框字典等
// 查询单据类型 10领料出库11委外领料出库20采购退货出库30销售出库40其它出库50返修出库60报废出库70补料出库列表
export function getOrderTypeList () {
  return request({
    url: `${adminUrl}dict/type/wms_out_order_type`,
    method: "get",
  });
}
//来源字典
export function getSourceTypeList () {
  return request({
    url: `${adminUrl}dict/type/required_source_type`,
    method: "get",
  });
}
// 查询订单状态 10创建20出库中30完成列表
export function getOrderStatusList () {
  return request({
    url: `${adminUrl}dict/type/wms_out_order_status`,
    method: "get",
  });
}
// // 获取仓库信息
// export function getCurrentWarehouseCode() {
//   return request({
//     url: `${wmsserviceUrl}basic`,
//     method: "get",
//   });
// }
//关闭主表
export function closeOrder (ids) {
  return request({
    url: `${mesUrl}mesRequisitionOrder/closeOrder/${ids}`,
    method: "post",
  });
}
//获取弹窗数据
export function getMaterialListById (ids) {
  return request({
    url: `${mesUrl}mesRequisitionOrder/getMaterialListById/${ids}`,
    method: "get",
  });
}
//弹窗数据查询
export function mesRequisitionOrderMaterials (data) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/getMaterialListById`,
    method: "post",
    data,
  });
}
//弹窗数据查询
export function getMaterialListByIdDialog (data) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/getMaterialListByIdDialog`,
    method: "post",
    data,
  });
}
//领料单修改
export function updateMaterial (data) {
  return request({
    url: `${mesUrl}mesRequisitionOrderMaterials/updateMaterial`,
    method: "post",
    data,
  });
}
